<section id="<?php print $block_html_id; ?>" >

    <?php
global $infopark;

	$current_city_info = $infopark->get_city_by_url();
	#pre($current_city_info);
	$current_city = $current_city_info['current_city'];
	
	$current_city_name = $current_city_info['current_city_name'];
	
	$cities_list=$infopark->cities_list();
/*
	$cities_list = array (
		20 => 'Харьков',
		21 => 'Киев',
		41 => 'Одесса',
		57 => 'Керчь'
	);*/
        
    if(!isset($_GET['category']))
        { 
        drupal_add_js('misc/front.js');
        echo $infopark->places_ajax_engine();
        //echo template_frontpage_places();
        
        }
    ?>


<?if(!empty($block->{'#selected_category'})):?><h1 class="title"><?php echo $block->{'#selected_category'}.' '.$current_city_name; ?></h1><?endif;?>
<?if(isset($_GET['category'])){ ?><a href="javascript://" onclick="show_places_list();" class="places_list_btn">Смотреть списком по алфавиту</a><?}?>
    <div class="container" id="columns">
        <?php 
        foreach ($block->{'#places'} as $p)
        { 
             echo $infopark->draw_place_tile($p);
        }
        ?>

    </div>

</section>
<?/*
 * 1if( ($current_city && $p->field_place_city_tid == $current_city ) || ($current_city == 0))
                {<div class="pin">
 

            <a href="<?php echo $p->alias; ?>">
			<?php if (isset($p->uri)) : ?>
					<div class="thumb"><img src="<?php echo image_style_url('w220', $p->uri); ?>" /></div>
			<?php else : ?>
				<div class="thumb<?=(($p->num_events)?' place_with_event':'');?>"></div>
			<?php endif; ?>
            </a>

				<div class="info">
		            <h2><?php echo l($p->title, 'node/' . $p->nid); ?> <?=(($p->num_events)?l('<img src="/themes/epimetheus/images/fav_icon.png" id="place_with_event" title="Есть новые Афиши">','node/'.$p->nid,array('html'=>true,'attributes'=>array('rel'=>'nofollow'))):'');?></h2>

					<table class="short_info">
						<tr>
                            <td class="short_info_label">
                                <div class="icon city"></div>
                            </td>
                            <td>
                                <a href="<?php echo get_city_url_by_id($p->field_place_city_tid) ; ?>" class="city_link"> <?php echo $cities_list[$p->field_place_city_tid]->name; ?></a>
                            </td>
						</tr>
						<tr>
							<td class="short_info_label">
								
							</td>
							<td>
								<?php if ($p->field_place_address_value) : ?>
								<?php echo nl2br($p->field_place_address_value); ?>
								<?php endif; ?>
							</td>
						</tr>

						<tr>
							<td>
								<div class="icon phone"></div>
							</td>
							<td>
								<?php if ($p->field_place_phone_value) : ?>
								<?php echo $p->field_place_phone_value; ?>
								<?php endif; ?>
							</td>
						</tr>

					</table>
				</div>
            <?php /*if (user_access('bypass node access')) : ?>
                <div class="admin-link">
                <?php echo l('Редактировать', 'node/' . $p->nid . '/edit'); ?>
                </div>
            <?php endif; */?>